package liportest.controller;


import liportest.Entity.TestEntity;
import liportest.ResponseEntity;
import liportest.hibenit.TestRepositoryHib;
import liportest.repository.TestRepository;
import liportest.third.ThirdNextId;
import liportest.third.ThirdNextIdImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CustomerController {
    @Autowired
    private TestRepository testRepository;
    @Autowired
    private TestRepositoryHib testRepositoryHib;
    @Autowired
    private ThirdNextId thirdNextId;
    @Autowired
    private ThirdNextIdImpl thirdNextIdImpl;

    @GetMapping("/re")
    @ResponseBody
    public Long register() {
        return testRepository.findCompanyRootDepartment();
    }

    @GetMapping("/reh")
    public Long registerHib() {
        return testRepositoryHib.findCompanyRootDepartment();
    }

    @GetMapping("/nex")
    public Long nextId() {
        return testRepository.nextId();
    }

    @GetMapping("/nexh")
    public Long nexthId() {
        return testRepositoryHib.nextId();
    }

    @GetMapping("/th")
    public Long thId() {
        return thirdNextIdImpl.nextId();
    }


    @GetMapping("/the")
    public ResponseEntity thIdC() {

        long l = thirdNextIdImpl.aa();


        return new ResponseEntity(l);
    }

//    @GetMapping("/hehe")
//    public List<Integer> gethehe(@ModelAttribute TestEntity testEntity) {
//        List<Integer> ids = testEntity.getIds();
//        return ids;
//    }

}
